package com.qianyu.project.mapper.provider.mfy;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qianyu.project.entity.DeviceCollect;
import com.qianyu.project.entity.DeviceMaintain;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.StringUtils;

import java.util.Map;

/**
 * @Author mfy
 * @desc
 */
public class DeviceCollectProvider {
    public String Mylist(IPage<DeviceCollect> page, Map<String, String> params){
        return new SQL(){
            {
                SELECT("*");
                FROM(" device_collect dc,system_user su,dept d,project_info pi,material_info mi");
                WHERE("dc.did=d.id and dc.p_id=pi.id and dc.fill_user=su.id and mi.id=dc.material_id");
                if(!StringUtils.isEmpty(params.get("approveStatus"))){
                    WHERE("dc.approve_status = '"+params.get("approveStatus")+"'");
                }

            }
        }.toString();
    }

    public String listNopage(Map<String, String> params){
        return new SQL(){
            {
                SELECT("*");
                FROM(" device_collect dc,system_user su,dept d,project_info pi,material_info mi");
                WHERE("dc.did=d.id and dc.p_id=pi.id and dc.fill_user=su.id and mi.id=dc.material_id");
                if(!StringUtils.isEmpty(params.get("approveStatus"))){
                    WHERE("dc.approve_status = '"+params.get("approveStatus")+"'");
                }
            }
        }.toString();
    }
}
